package com.wedjg.concurrency.example.publish;

import com.wedjg.concurrency.annotations.NotRecommend;
import com.wedjg.concurrency.annotations.NotThreadSafe;

/**
 * 逸出类
 * 在Escape尚未构造完毕时，InnerClass就使用了escapeValue
 * @author wedjg
 * @version 1.0
 * @date 2019/6/2
 */
@NotThreadSafe
@NotRecommend
public class Escape {

    private int escapeValue = 0;

    public Escape() {
        new InnerClass();
    }

    private class InnerClass {
        public InnerClass() {
            System.out.println(Escape.this.escapeValue);
        }
    }

    public static void main(String[] args) {
        new Escape();
    }
}
